using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;using Maxleaf.EDI.Domain.K3;

namespace Maxleaf.EDI.DataAccess.K3
{
    public class POInStockEntryMap : EntityTypeConfiguration<POInStockEntry>
    {
        public POInStockEntryMap()
        {
            // Primary Key
            this.HasKey(t => new { t.FInterID, t.FEntryID });

            // Properties
            this.Property(t => t.FBrNo)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.FInterID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FEntryID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FNote)
                .IsFixedLength()
                .HasMaxLength(255);

            this.Property(t => t.FMapNumber)
                .IsRequired()
                .HasMaxLength(80);

            this.Property(t => t.FMapName)
                .HasMaxLength(256);

            this.Property(t => t.FBatchNo)
                .IsRequired()
                .HasMaxLength(200);

            this.Property(t => t.FSourceBillNo)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FContractBillNo)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FOrderBillNo)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FMTONo)
                .IsRequired()
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("POInStockEntry");
            this.Property(t => t.FBrNo).HasColumnName("FBrNo");
            this.Property(t => t.FInterID).HasColumnName("FInterID");
            this.Property(t => t.FEntryID).HasColumnName("FEntryID");
            this.Property(t => t.FItemID).HasColumnName("FItemID");
            this.Property(t => t.FQty).HasColumnName("FQty");
            this.Property(t => t.FCommitQty).HasColumnName("FCommitQty");
            this.Property(t => t.FPrice).HasColumnName("FPrice");
            this.Property(t => t.FAmount).HasColumnName("FAmount");
            this.Property(t => t.FNote).HasColumnName("FNote");
            this.Property(t => t.FInvoiceQty).HasColumnName("FInvoiceQty");
            this.Property(t => t.FBCommitQty).HasColumnName("FBCommitQty");
            this.Property(t => t.FQCheckQty).HasColumnName("FQCheckQty");
            this.Property(t => t.FAuxQCheckQty).HasColumnName("FAuxQCheckQty");
            this.Property(t => t.FUnitID).HasColumnName("FUnitID");
            this.Property(t => t.FAuxBCommitQty).HasColumnName("FAuxBCommitQty");
            this.Property(t => t.FAuxCommitQty).HasColumnName("FAuxCommitQty");
            this.Property(t => t.FAuxInvoiceQty).HasColumnName("FAuxInvoiceQty");
            this.Property(t => t.FAuxPrice).HasColumnName("FAuxPrice");
            this.Property(t => t.FAuxQty).HasColumnName("FAuxQty");
            this.Property(t => t.FSourceEntryID).HasColumnName("FSourceEntryID");
            this.Property(t => t.FQtyPass).HasColumnName("FQtyPass");
            this.Property(t => t.FAuxQtyPass).HasColumnName("FAuxQtyPass");
            this.Property(t => t.FMapNumber).HasColumnName("FMapNumber");
            this.Property(t => t.FMapName).HasColumnName("FMapName");
            this.Property(t => t.FBatchNo).HasColumnName("FBatchNo");
            this.Property(t => t.FKFDate).HasColumnName("FKFDate");
            this.Property(t => t.FKFPeriod).HasColumnName("FKFPeriod");
            this.Property(t => t.FDCSPID).HasColumnName("FDCSPID");
            this.Property(t => t.FAuxPropID).HasColumnName("FAuxPropID");
            this.Property(t => t.FDCStockID).HasColumnName("FDCStockID");
            this.Property(t => t.FFetchDate).HasColumnName("FFetchDate");
            this.Property(t => t.FSecCoefficient).HasColumnName("FSecCoefficient");
            this.Property(t => t.FSecQty).HasColumnName("FSecQty");
            this.Property(t => t.FSecCommitQty).HasColumnName("FSecCommitQty");
            this.Property(t => t.FSourceTranType).HasColumnName("FSourceTranType");
            this.Property(t => t.FSourceInterId).HasColumnName("FSourceInterId");
            this.Property(t => t.FSourceBillNo).HasColumnName("FSourceBillNo");
            this.Property(t => t.FContractInterID).HasColumnName("FContractInterID");
            this.Property(t => t.FContractEntryID).HasColumnName("FContractEntryID");
            this.Property(t => t.FContractBillNo).HasColumnName("FContractBillNo");
            this.Property(t => t.FOrderInterID).HasColumnName("FOrderInterID");
            this.Property(t => t.FOrderEntryID).HasColumnName("FOrderEntryID");
            this.Property(t => t.FOrderBillNo).HasColumnName("FOrderBillNo");
            this.Property(t => t.FStockID).HasColumnName("FStockID");
            this.Property(t => t.FPeriodDate).HasColumnName("FPeriodDate");
            this.Property(t => t.FNotPassQty).HasColumnName("FNotPassQty");
            this.Property(t => t.FNPCommitQty).HasColumnName("FNPCommitQty");
            this.Property(t => t.FSampleBreakQty).HasColumnName("FSampleBreakQty");
            this.Property(t => t.FConPassQty).HasColumnName("FConPassQty");
            this.Property(t => t.FConCommitQty).HasColumnName("FConCommitQty");
            this.Property(t => t.FAuxNotPassQty).HasColumnName("FAuxNotPassQty");
            this.Property(t => t.FAuxNPCommitQty).HasColumnName("FAuxNPCommitQty");
            this.Property(t => t.FAuxSampleBreakQty).HasColumnName("FAuxSampleBreakQty");
            this.Property(t => t.FAuxConPassQty).HasColumnName("FAuxConPassQty");
            this.Property(t => t.FAuxConCommitQty).HasColumnName("FAuxConCommitQty");
            this.Property(t => t.FAuxRelateQty).HasColumnName("FAuxRelateQty");
            this.Property(t => t.FRelateQty).HasColumnName("FRelateQty");
            this.Property(t => t.FBackQty).HasColumnName("FBackQty");
            this.Property(t => t.FAuxBackQty).HasColumnName("FAuxBackQty");
            this.Property(t => t.FSecBackQty).HasColumnName("FSecBackQty");
            this.Property(t => t.FSecConCommitQty).HasColumnName("FSecConCommitQty");
            this.Property(t => t.FPlanMode).HasColumnName("FPlanMode");
            this.Property(t => t.FMTONo).HasColumnName("FMTONo");
        }
    }
}
